﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameStudio.CodeGeneration;
using System.Reflection;
using System.CodeDom;

namespace GameStudio.Common.CodeGeneration
{
    class GenerateTriangle:Sample
    {
        public GenerateTriangle(string strFileName, string Path, string NameSpace)
            : base(strFileName, Path, NameSpace)
        {
            base.AssignObjects();
            base.Init();
            targetClass.IsClass = true;
            targetClass.TypeAttributes = TypeAttributes.Public;
            base.AddConstructor(null);//23mel ctor to assign arr[3][3][] with pos
        }

        protected void AddMyFields()
        {
            CodeMemberField mf = base.AddFields("TriangleBase", "Node[]");
            mf.Attributes = MemberAttributes.Public;
            targetClass.Members.Add(mf);
            CodeArrayCreateExpression AssignArr= new CodeArrayCreateExpression("Node" , 3);
            CodeSnippetStatement csu1 = new CodeSnippetStatement("TriangleBase =");
            constructor.Statements.Add(csu1);
            constructor.Statements.Add(AssignArr);
        }

        public void Generate(string file)
        {
            AddMyFields();
            targetClass.Members.Add(constructor);
            base.GenerateCSharpCode();
        }
    }
}
